package com.wanmait.myhouse.mediatorController;

import com.wanmait.myhouse.dao.*;
import com.wanmait.myhouse.vo.*;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.HttpRequestHandler;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.http.HttpRequest;
import java.util.List;

@Controller
@RequestMapping("mediator")
public class MediatorBcTypographyController {
    @GetMapping("delete")
    public String delete(Integer id){
        HouseDAO houseDAO = new HouseDAO();
        houseDAO.deleteById(id);
        return "redirect:/mediator/showHouse";
    }

    @GetMapping("bcTypography")
    public String bcTypography(Model model,Integer id){
        HouseDAO houseDAO = new HouseDAO();
        House house = houseDAO.FindById(id);
        model.addAttribute("house",house);
        SellMannerDAO sellMannerDAO = new SellMannerDAO();
        List<SellManner> sellMannerList = sellMannerDAO.selectAll();
        model.addAttribute("sellMannerList",sellMannerList);
        return "/mediator/bc_typography";
    }
}
